package com.fits.auth.api.service.login;

import com.fits.auth.api.constants.ClientEnums;
import com.fits.framework.core.response.Result;
import com.fits.starter.common.security.LoginUserDTO;
import com.fits.ums.client.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class FitsService implements CommonService {
    @Autowired
    private UserService userService;

    @Override
    public String getClient() {
        return ClientEnums.FITS_USER.getClientId();
    }

    @Override
    public LoginUserDTO getUser(String username) {
        Result<LoginUserDTO> result = userService.loadUserByUsername(username);
        if (result.isSuccess()) {
            return result.getData();
        }
        return null;
    }
}
